package com.gnar.dis;

import android.graphics.Bitmap;
import android.graphics.Rect;

public class Sprite {

	//TODO: Vector::magnitude() returns float
	//TODO: Vector::normalize() returns Vector
	//TODO: Vector::magnitudeSQ() returns float
	// 
	//TODO: Sprite has member object Particle  w/ x, y ,z
	//TODO: Particle::GetPosition() returns Vector
	//TODO: Particle::AddForce(Vector f) returns void
	protected float mPosX;
    protected float mPosY;

	//TODO: Sprite has member function GetParticle() returns Vector
	//TODO:  AddForce(Particle)
    protected float mAccelX;
    protected float mAccelY;
    protected float mLastPosX;
    protected float mLastPosY;
    protected float mOneMinusFriction;
    protected float mMass;
    protected type spriteType;

	// TODO: Image data should probably originate from an object - CP
	// TODO: This object could probably have useful methods:
	// 				SetLoop(true)
	// 				SetFrame()
	// 				Hold() -hold on frame
	// 		See what ImageView functionality exists and how it can be used. - CP
    protected Bitmap mImage;
    protected Rect mRect;
    
    public enum type {
    	SHIP, BOMB, DEST_OB, HUMAN
    }
    
	/** @param bitmap A description that is fitting for a king
	 *
	 */
	public Sprite(Bitmap bitmap, float startPosX, float startPosY) {
        mImage = bitmap;

        mPosX = startPosX;
        mPosY = startPosY;
        
        mRect = new Rect((int)mPosX,(int)mPosY, (int)mPosX + (int)mImage.getWidth(), (int)mPosY + (int)mImage.getHeight());
        
    }
	
	public Bitmap getImage() {
		return mImage;
	}
	
	public type getType() {
		return spriteType; 
	}
	
	public float getPosX() {
		return mPosX;
	}
	
	public float getPosY() {
		return mPosY;
	}
	
	public Rect getRect() {
		return mRect;
	}
	
	public void update(EventHandler event) {
		mPosX = mPosX + 1;
	}
	
	public void destroy(){
		spriteType = type.DEST_OB;
	}
}
